package com.csdj.produt.controller;

import com.alibaba.fastjson.JSON;
import com.csdj.produt.entity.Product;
import com.csdj.produt.service.ProdutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProdutController {

    @Autowired
    private ProdutService produtService;

    @GetMapping("/product/get/{id}")
    public String getProduct(@PathVariable String id){
        Product product = produtService.seve(id);
        return JSON.toJSONString(product);
    }
}
